package com.cxl.demo.mapper;

import com.cxl.demo.vo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

@Mapper
public interface UserMapper {

    User findUserByUserId(Integer userId);
        //上下代码稍显冗余但是安全性更重要，下方代码保护用户信息。
    User findUserInfoByUserId(Integer userId);


    String findNickNameByUserId(Integer userId);

    User findUserByUserIdAndPassword(Integer openId, String password);

    Integer addUser(User user);

    Integer updateUser(User user);

    Integer updateAddScore(Integer userId,Double score);

    Integer updateSubScore(Integer userId,Double score);

    Double getUserScore(Integer userId);


@Delete("delete from user where userId=#{userId}")

    Integer delUser(Integer userId);

@Select("select count(1) from user where typeId=2")
    Integer GetBusinessNum();



    @Select("select * from user where typeId=2 limit #{page} ,#{size}")
    List<User> GetBusinessList(Map<String,Object>map);



    @Select("select nickName from user where userId=2")
    Integer GetNickName();


}
